 <#include "/common.include"/>
package ${packageName}.${moduleName}.controller;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yhsarchives.common.dao.PaginatedHelper;
import com.yhsarchives.common.easyui.EasyuiGridResult;
import com.yhsarchives.common.vo.CommonResultVo;
import com.yhsarchives.entitys.T${className}Bean;
import ${packageName}.${moduleName}.service.${className}Service;
import ${packageName}.${moduleName}.vo.${className}Vo;

<#include "/java.imports.include">

/**
 * ${webNameCN}控制器
 * @author DELL
 *
 */
@Controller
@RequestMapping("/${classNameLowerCase}")
public class ${className}Controller {
	
	
	@Autowired
	private ${className}Service ${classNameFirstLower}Service;
	/**
	 * ${webNameCN}页面
	 * @return
	 */
	@RequestMapping(value="${classNameFirstLower}Page", method=RequestMethod.POST)
	public String servicePage(){
		return "${moduleName}/${webName}";
	}
	
	/**
	 * ${webNameCN}分页列表
	 * @param paginatedHelper
	 * @param customerVo
	 * @return
	 */
	@RequestMapping(value="get${className}PageList", method=RequestMethod.POST)
	@ResponseBody
	public EasyuiGridResult getPageList(PaginatedHelper paginatedHelper, ${className}Vo ${classNameFirstLower}Vo){
		return ${classNameFirstLower}Service.getPageList(paginatedHelper, ${classNameFirstLower}Vo);
	}
	
	
	/**
	 * 保存${webNameCN}
	 * @param customer
	 * @param req
	 * @return
	 */
	@RequestMapping(value="save${className}")
	@ResponseBody
	public CommonResultVo save(${className}Vo ${classNameFirstLower}Vo){
		try {
			return ${classNameFirstLower}Service.save(${classNameFirstLower}Vo);
		} catch (Exception e) {
			e.printStackTrace();
			return new CommonResultVo(false, "保存失败!");
		}
	}
	
	/**
	 * 删除${webNameCN}
	 * @param customerId
	 * @return
	 */
	@RequestMapping(value="delete${className}", method=RequestMethod.POST)
	@ResponseBody
	public CommonResultVo delete(${pkColumnType} ${pkColumnName}){
		if(!${classNameFirstLower}Service.isUsed(${pkColumnName})){
			${classNameFirstLower}Service.delete(${pkColumnName});
			return new CommonResultVo(true, "删除成功!");
		}
		return new CommonResultVo(false, "${webNameCN}已被关联,不能删除!");
	}
	
	/**
	 * 获取所有的服务列表
	 * @return
	 *//*
	@RequestMapping(value="getServices")
	@ResponseBody
	public List<TServiceBean> getServices(){
		return serviceItemService.getList(TServiceBean.class);
	}*/
	
	
}
